from selenium import webdriver


def open_browser(browser="chrome"):
    if browser == "chrome":
        return webdriver.Chrome()
    elif browser == "firefox":
        return webdriver.Firefox()
    elif browser == "edge":
        return webdriver.Edge()
    else:
        print("不支持该浏览器")
host = 'http://139.129.26.163/ecshop/'

def browser_operation(browser='chrome'):
    # 添加chrome浏览器无头模式
    options = webdriver.ChromeOptions()

    if browser == 'chrome':
        return webdriver.Chrome(options=options)
    elif browser == 'firefox':
        return webdriver.Firefox()
    elif browser == 'ie':
        return webdriver.Ie()
    elif browser == 'edge':
        return webdriver.Edge()
    else:
        print('请使用以下浏览器:chrome|firefox|ie|edge')